#pragma once
#include "framework.h"
#include <time.h>
#include <math.h>
#include <fstream>
#include <iostream>

using namespace poly;
using namespace std;

//Mind the mess.

class Game : public IGame
{
public:
	Game( HINSTANCE hInst, HWND hWnd );
	~Game();

	virtual void onCreateGraphics( D3DDevice device );
	virtual void onResetGraphics( D3DDevice device );

	virtual void onFrameMove(float dt);
	virtual void onFrameRender(float dt);

	virtual void onLostGraphics();
	virtual void onDestroyGraphics();

	//TEST RELATED
	void initializeBoxArray();	//Initializes the list of boxes
	void initializePlayers();
	void updatePlayerBox(float dt);
	void drawPlayerBox();
	void drawAIBox();

	//ENEMY BOX
	void enemyUpdate(float dt);
	int  enemyMoveWhere();
	void enemyMove(int moveTo, float dt);

	//UTILITIES
	void writeToFile(float f);

private:
	D3DDevice	m_d3dDevice;

	SInput		m_input;
	Camera		m_camera;

	PolygonView	m_polygonView;

	//TEST MEMBERS
	struct box{
		D3DXVECTOR3 center;
		D3DXVECTOR3 boxN;
		D3DXVECTOR3 boxS;
		D3DXVECTOR3 boxE;
		D3DXVECTOR3 boxW;
		poly::Polygon	m_polygon_0;
		poly::Polygon	m_polygon_1;
	};
	box boxArray[7];

	box	playerBox;
	Visibility playerVis;
	float playerSpeed;
	box	aiBox;
	float3 playerMoveTo;
	float3 aiMoveTo;
	float rotationalSpeed;
};
